<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

  <style>
    .box1 {
      height: 1500px;
      background-color: pink;
    }
  </style>
</head>

<body>


  <button id="btn">阻止滚轮进行滚动</button>
  <div class="box1"> 很长的div</div>


  <script>
    btn.onclick = function () {


      // 要加上第三个参数才有效果,因为浏览器默认对滚轮事件做了优化处理
      window.addEventListener('wheel', wheelHandle, {
        passive: false
      })

      function wheelHandle(e) {
        e.preventDefault();
      }

    }
  </script>
</body>

</html>